/**
 * AgeInverseSorterer.java
 * ************************** 
 * @date Apr 27, 2011
 * @author Michele Tamburini
 * 
 * **************************
 */
package gossipServices.basic.nodeDescriptors.comparators;

import gossipServices.basic.nodeDescriptors.NodeDescriptor;
import gossipServices.basic.nodeDescriptors.PssNodeDescriptor;

/**
 * Description: 
 * It takes two PssNodeDescriptor(s) in input and compute the inverse
 * comparison of the AgeSorterer, so returns:
 *    1 if o1.getAge() < o2.getAge();
 *    0 if o1.getAge() == o2.getAge();
 *   -1 if o1.getAge() > o2.getAge();
 *
 */
public class AgeInverseSorterer implements NodeDescriptorComparator {

	/**
	 * 
	 */
	public AgeInverseSorterer() {	}

	@Override
	public int compare(NodeDescriptor o1, NodeDescriptor o2) {
		PssNodeDescriptor pssO1 = (PssNodeDescriptor) o1;
		PssNodeDescriptor pssO2 = (PssNodeDescriptor) o2;
		return pssO2.getAge().compareTo(pssO1.getAge());
	}

}
